<!DOCTYPE html>
<html>
<head>
	<title>使用原生 AJAX 请求搜索结果并解码为 Base64</title>
	<script>
		const urlParams = new URLSearchParams(window.location.search);
		const keyword = urlParams.get('keyword');

		function decodeBase64(base64Str) {
			return atob(base64Str);
		}

		function fetchSearchResults() {
			const xhr = new XMLHttpRequest();
			xhr.onreadystatechange = function() {
				if (this.readyState === 4 && this.status === 200) {
					const base64Data = this.responseText;
					const decodedData = decodeBase64(base64Data);
					document.body.innerHTML = decodedData;
				}
			};
			xhr.open('GET', `https://upapi.juapp9.com/search?keyword=${keyword}`);
			xhr.send();
		}

		window.onload = function() {
			fetchSearchResults();
		};
	</script>
</head>
<body>
</body>
</html>
